﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;

namespace Kiosk.Library
{
    partial class EmployeeInfo
    {
        public static EmployeeInfo GetEmployeeInfoByUserName(string user)
        {
            var emp = EmployeeReadOnlyList.GetAll().FirstOrDefault(e => e.DomainName.ToLower() == user.ToLower());
            return emp;
        }

        public string PhoneEmail
        { 
            get
            {
                string addr = Regex.Replace(this.CellPhone, @"[-)(\.]","");
                addr += "@" + CellProviderInfo.GetCellProviderInfoById(this.CellProviderID).SmsGateway;
                return addr;
            }
        }

        public string LastNameFirst
        {
            get
            {
                return LastName + ", " + FirstName; 
            }
        }

        public string LastNameComma
        { get { return LastName + ","; } }

        public string FullName
        {
            get
            {
                return FirstName + " " + LastName;
            }
        }

        public Point LocationPoint
        {
            get
            {
                LocationInfo l = LocationInfo.GetLocationInfoById(this.LocationID);
                return new Point(l.XCoordinate, l.YCoordinate);
            }
        }
        public string LocationName
        {
            get
            {
                return Library.Location.GetLocation(this.LocationID).Name;
            }
        }
    }
}
